﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.ComponentModel.Composition;

namespace Kooboo.Commerce.Repositories
{
    [Export(typeof(IShipping))]
    partial class Shipping : Entity, IShipping
    {


        List<IShippingCostRule> shippingCostRules;

        List<IShippingCostRule> IShipping.ShippingCostRules
        {
            get
            {
                if (this.shippingCostRules == null)
                {
                    this.shippingCostRules = this.DataContext.ShippingCostRules
                        .Where(i => i.ShippingId == this.Id)
                        .Select(i=> i as IShippingCostRule)
                        .ToList();
                }

                return this.shippingCostRules;
            }
            set
            {
                this.shippingCostRules = value;
            }
        }

    }
}
